package com.lanou3g.springmvc.service.impl;

import com.lanou3g.springmvc.bean.User;
import com.lanou3g.springmvc.dao.UserDao;
import com.lanou3g.springmvc.service.UserService;
import com.lanou3g.springmvc.web.HelloController;

import java.util.List;

public class UserServiceImpl implements UserService {

    private UserDao userDao;

    private HelloController helloController;

    @Override
    public List<User> queryUser() {

        System.out.println("helloController: " + helloController);

        return userDao.queryAllUser();
    }

    @Override
    public int saveUser(User user) {
        return userDao.insertUser(user);
    }

    @Override
    public User findById(Integer id) {
        return userDao.findById(id);
    }

    @Override
    public int deleteById(Integer id) {
        return userDao.deleteById(id);
    }

    @Override
    public int update(User user) {
        return userDao.update(user);
    }

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }


    public void setHelloController(HelloController helloController) {
        this.helloController = helloController;
    }
}
